package com.itheima.Wuziqi.entity;

import com.itheima.Wuziqi.ui.Board;
import com.itheima.Wuziqi.service.GameRule;

import java.awt.Point;

/**
 * 人类玩家实现
 */
public class HumanPlayer implements Player {
    private int type;
    private String name;
    private Point lastMove;
    
    public HumanPlayer(int type, String name) {
        this.type = type;
        this.name = name;
    }
    
    @Override
    public int getType() {
        return type;
    }
    
    @Override
    public Point makeMove(Board board, GameRule rule) {
        // 人类玩家的落子由UI交互决定，这里返回最后一次点击的位置
        return lastMove;
    }
    
    // 设置人类玩家的落子位置（由UI调用）
    public void setMove(Point move) {
        this.lastMove = move;
    }
    
    @Override
    public String getName() {
        return name;
    }
}
    